using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace MeetingRoom.Data.Implementation
{
    public abstract class MeetingRoomDAOSupport
    {
        public static List<MeetingRoom.Domain.MeetingRoom>
            GetMeetingRooms(IDataReader dataReader)
        {
            SimpleMeetingRoomTypeQuery query = new SimpleMeetingRoomTypeQuery();

            List<MeetingRoom.Domain.MeetingRoom> list
                = new List<MeetingRoom.Domain.MeetingRoom>();

            while (dataReader.Read())
            {
                MeetingRoom.Domain.MeetingRoom meetingRoom =
                    new MeetingRoom.Domain.MeetingRoom();
                meetingRoom.Name = (string)dataReader["name"];
                meetingRoom.Status = (int)dataReader["status"];

                int meetingRoomTypeId = (Int32)dataReader["meetingRoomType_Id"];
                meetingRoom.MeetingRoomType = query.GetMeetingRoomTypeById(meetingRoomTypeId);

                list.Add(meetingRoom);
            }
            return list;
        }
    }
}
